﻿#include "Widget.h"
#include "ui_Widget.h"
#include <QPainter>
#include "PersonThinBuilder.h"
#include "PersonFatBuilder.h"
#include "PersonDirector.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::paintEvent(QPaintEvent *event)
{
    QPainter painter(this);

    auto ptb = std::shared_ptr<PersonThinBuilder>(new PersonThinBuilder(&painter));
    auto pdThin = std::shared_ptr<PersonDirector>(new PersonDirector(ptb));
    pdThin->CreatePerson();

    auto pfb = std::shared_ptr<PersonFatBuilder>(new PersonFatBuilder(&painter, 100));
    auto pdFat = std::shared_ptr<PersonDirector>(new PersonDirector(pfb));
    pdFat->CreatePerson();
}


